﻿<!--
Name:用户中心-常购清单
Page:All
-->
<div class="nbbox clearfix">
<div class="user">
    <div class="searchbox clearfix">
        <input type="text" id="key" name="key" class="input-query" value="<%=key %>" onkeydown="if(event.keyCode==13){search_();}" />
        <a href="javascript:void(0)" onclick="search_();" class="btn btn-12"><s></s>{tag:查询}</a>
    </div>
    <div class="table-list loadlist">
        <%foreach (Shop.Model.Lebi_User_Product u_p in user_products)
        {Shop.Model.Lebi_Product product=GetProduct(u_p.Product_id);
        %>
        <div class="loadli">
        <table cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <th style="width:50px" valign="top" rowspan="3"><% if (product.ImageOriginal == ""){ %>&nbsp;<%}else{ %><a href="<%=URL("P_Product",u_p.Product_id) %>"><img style="height: 50px;width: 50px;vertical-align:middle" src="<%=Image(product.ImageOriginal,50,50) %>" /></a><%} %></th>
            <th style="text-align:left" valign="top">
            <input type="checkbox" name="id" value="<%=u_p.id %>" sel="true" /><input type="hidden" name="Uid" value="<%=u_p.id %>" shop="true" />
            <a href="<%=URL("P_Product",u_p.Product_id) %>"><%=Lang(product.Name)%></a>
            </th>
            <th style="width:60px" valign="top"><%=FormatMoney(product.Price) %></th>
        </tr>
        <tr>
            <td colspan="2">{tag:购买周期}：<input name="WarnDays<%=u_p.id %>" id="Text1" type="text" value="<%=u_p.WarnDays %>" onkeyup="value=value.replace(/[^\d]/g,'');" shop="true" size="3" maxlength="5" class="input" /> {tag:天}&nbsp;&nbsp;{tag:数量}：<input name="Count<%=u_p.id %>" id="Text2" type="text" value="<%=u_p.count %>" onkeyup="value=value.replace(/[^\d]/g,'');" shop="true" size="3" maxlength="5" class="input" /></td>
        </tr>
        <tr>
            <td colspan="2">{tag:预购时间}：<%=FormatDate(u_p.Time_Add)%></td>
        </tr>
        </table>
        </div>
        <%} %>
    </div>
    <div class="bottom clearfix"><div class="left"><a href="javascript:void(0);" onclick="$('input[name=\'id\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));" class="selectAll">{tag:全选}</a>&nbsp;&nbsp;<a href="javascript:void(0)" onclick="Delete();" class="btn btn-11"><s></s>{tag:删除}</a><a href="javascript:void(0)" onclick="Update();" class="btn btn-11"><s></s>{tag:保存}</a><a href="javascript:void(0)" onclick="LikeToBasket();" class="btn btn-7"><s></s>{tag:加入购物车}</a></div></div>
    <%if (CurrentSite.IsMobile==0){ %>
        <div class="bottom clearfix"><div class="right"><%=PageString%></div></div>
    <%}else{%>
    <div class="loadpage">
        <a data-next="<%=NextPage%>"></a>
    </div>
    <script>
        $(document).ready(function () {
            var container = document.querySelector('.loadlist');
            var ias = $.ias({
                container: ".loadlist",
                item: ".loadli",
                pagination: ".loadpage",
                next: ".loadpage a"
            });
            ias.on('render', function (items) {
                //$(items).css({ opacity: 0 });
            });
            ias.on("rendered", function (items) {
            });
            ias.extension(new IASSpinnerExtension({ html: "<div class=\"loadinginfo\"><img src=\"{src}\" />&nbsp;{Tag:加载中}</div>" }));
            ias.extension(new IASTriggerExtension({ text: '{Tag:加载更多}', offset: 100, html: "<div class=\"loadinginfo more\"><p>{text}</p></div>" }));
            ias.extension(new IASNoneLeftExtension({
                text: '', html: ""
            }));
        });
    </script>
    <%}%>
</div>
</div>
<script type="text/javascript" >
    function search_() {
        var key = $("#key").val();
        window.location = "?key=" + escape(key);
    }
    function Delete() {
        if (!confirm("{tag:确认要删除吗？}"))
            return false;
        var postData = GetFormJsonData("sel");
        var url = path+"/Ajax/Ajax_userin.aspx?__Action=UserOftenBuy_Del";
        RequestAjax(url, postData, function () { MsgBox(1, "{tag:操作成功}", "?") });
    }
    function Update() {
        var postData = GetFormJsonData("shop");
        var url = path+"/Ajax/Ajax_userin.aspx?__Action=UserOftenBuy_Update";
        RequestAjax(url,postData,function(){MsgBox(1, "{tag:操作成功}", "?")});
    }
</script>